﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WTwitter.Model.UserData;
using WTwitter.Model.Twitter.Json;
using WTwitter.Model.Utility;
using System.Runtime.Serialization.Json;

namespace WTwitter.Model.Twitter.Utility {
	static class DirectMessageMethod {
		//APIのURL
		private static readonly string NewUrl = "http://api.twitter.com/1/direct_messages/new.json";

		/// <summary>
		/// New
		/// </summary>
		/// <param name="toUserName">宛先（Id or ScreenName）</param>
		/// <param name="text">投稿内容</param>
		/// <param name="info">認証情報</param>
		/// <returns>投稿した結果、サーバから返ってきたデータ</returns>
		public static DirectMessage New(string toUserName, string text, AuthInfo info)  {
			var parameters = new RequestParameter[] {
				new RequestParameter("user", toUserName),
				new RequestParameter("text", text)
			};
			return WebUtility<DirectMessage>.GetDeserializedJsonData(NewUrl, "POST", parameters, info);
		}
	}
}
